home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Programming / tek / examples / kine / mathutil.h < prev   
C/C++ Source or Header  |  2001-05-26  |  2KB  |  89 lines

  1. /*
  2.  *
  3.  *
  4.  *    Include for Matrixoperations
  5.  *    24.04.2001  Frank Pagels , Teil von MiniGL übernommen
  6.  *
  7.  */
  8.  
  9. #ifndef _MATRIX_H
  10. #define _MATRIX_H
  11.  
  12. #include <tek/mem.h>
  13.  
  14.  
  15. typedef struct Matrix_t
  16. {
  17.         TFLOAT v[16];
  18.         TINT flags;                  // Matrix flags
  19.         struct Matrix_t *Inverse;   // optional inverse
  20. } Matrix;
  21.  
  22.  
  23. typedef struct
  24. {
  25.         TINT    rows;
  26.         TINT    colum;
  27.         TFLOAT    m[20][20];
  28.         TINT    pvt_j[20];
  29.         TINT    pvt_i[20];
  30. } GenMatrix;
  31.  
  32.  
  33. #define OF_11 0
  34. #define OF_12 4
  35. #define OF_13 8
  36. #define OF_14 12
  37.  
  38. #define OF_21 1
  39. #define OF_22 5
  40. #define OF_23 9
  41. #define OF_24 13
  42.  
  43. #define OF_31 2
  44. #define OF_32 6
  45. #define OF_33 10
  46. #define OF_34 14
  47.  
  48. #define OF_41 3
  49. #define OF_42 7
  50. #define OF_43 11
  51. #define OF_44 15
  52.  
  53. /* Struktur für Gelenke */
  54. typedef struct
  55. {
  56.     TFLOAT    theta;
  57.     TINT    d;
  58.     TINT    a;
  59.     TINT    a1;
  60.     TFLOAT    alpha;
  61. } joint;
  62.  
  63.  
  64. TVOID MatMultGeneral(Matrix *pA, Matrix *pB, Matrix *pC);
  65. TVOID LoadIdentity(Matrix *pA);
  66. TVOID PrintMatrix(Matrix *pA);
  67. TVOID LoadMatrix(Matrix *pA, const TFLOAT *v);
  68. TFLOAT Determinant(Matrix *pA);
  69. TVOID DoInvert(Matrix *pA, Matrix *pB);
  70. TVOID GetHartenberg(joint *j, Matrix *pA);
  71. TVOID MatMultPoint(Matrix *pA, TFLOAT *v, TFLOAT *tmp);
  72. TVOID InitGenMatrix(GenMatrix *A, TINT row, TINT colum);
  73. TVOID DestroyGenMatrix(GenMatrix *A);
  74. TVOID GenPrintMatrix(GenMatrix *A);
  75. TVOID GenLoadMatrix(Matrix *pA, const TFLOAT *v);
  76. TVOID GenMatTranspose(GenMatrix *A, GenMatrix *B);
  77. TVOID GenMatMultiply(GenMatrix *A, GenMatrix *B, GenMatrix *C);
  78. TVOID GenMatLoadIdentity(GenMatrix *A, TFLOAT a);
  79. TVOID GenMatInvers(GenMatrix *A);
  80. TVOID GenMatCopy(GenMatrix *A,GenMatrix *B);
  81. TVOID GenMatPseudoInvers(GenMatrix *A,GenMatrix *B, GenMatrix *C);
  82. TVOID GenMatSub(GenMatrix *A,GenMatrix *B, GenMatrix *C);
  83. TVOID GenMatAdd(GenMatrix *A,GenMatrix *B, GenMatrix *C);
  84.  
  85.  
  86.  
  87.  
  88. #endif
  89.